export default {
    namespaced: true,
    state: {
        LoggingDisplay: false,
        AutoRefresh: false,
        DisplayType: "newest",
        LoggingPool: []
    },
    mutations: {
        vmLoggingOperate(state, option) {
            switch (String(option).toLowerCase()) {
                case "open":
                    state.LoggingDisplay = true;
                    break;
                case "close":
                    state.LoggingDisplay = false;
                    break;
                case "setautorefresh_true":
                    state.AutoRefresh = true;
                    break;
                case "setautorefresh_false":
                    state.AutoRefresh = false;
                    break;
                case "displaynewestmessage":
                    state.DisplayType = "newest";
                    break;
                case "displayhistorymessage":
                    state.DisplayType = "history";
                    break;
                case "clear":
                    state.LoggingPool.splice(0);
                    break;
            }
        },
        vmLoggingInitLog(state, option) {
            if (Object.prototype.toString.call(option) === "[object Array]") {
                state.LoggingPool.push(...option);
            }
        }
    }
}